package com.gwnet.cabinet.enums;

import lombok.Data;

/**
 * 使用状态
 * @author: WangLiang
 * @date: 2024/7/24 14:22
 */
public enum UseStatusEnum {

    IDLE(0,"空闲"),
    USED(1,"占用"),
    TIMEOUT(2,"超时");


    private Integer code;
    private String desc;

    UseStatusEnum(Integer code,String desc){
        this.code = code;
        this.desc = desc;
    }

    public Integer code() {
        return code;
    }

    public String desc() {
        return desc;
    }

    public static UseStatusEnum instance(Integer value) {
        UseStatusEnum[] enums = values();
        for (UseStatusEnum statusEnum : enums) {
            if (statusEnum.code().equals(value)) {
                return statusEnum;
            }
        }
        return null;
    }

}
